<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="stylesheet" href="./css/rigister.css">
    <link rel="stylesheet" href="./css/public.css">
    <script src="./js/jquery.js"></script>
    <script src="./js/layer/layer.js"></script>
</head>

<body>
    <header>
        <img class="logo" src="./images/注册页图片/logo.jpg" alt="">
        <ul class="ul_nav">
            <li class="lis">
                <a href="./index.html">联想首页</a>
            </li>
            <li class="lis">
                <a href="https://shop.lenovo.com.cn">商城</a>
            </li>
            <li class="lis">
                <a href="https://b.lenovo.com.cn/">企业购</a>
            </li>
            <li class="lis">
                <a href="https://newsupport.lenovo.com.cn/">服务</a>
            </li>
            <li class="lis">
                <a
                    href="https://i.lenovo.com.cn/memberInfo/v2/center.jhtml?sts=e40e7004-4c8a-4963-8564-31271a8337d8&amp;_ga=2.70748307.222010594.1632271014-332828211.1631927989">会员</a>
            </li>
            <li class="lis">
                <a href="https://club.lenovo.com.cn/">社区</a>
            </li>
            <li class="lis">
                <a href="https://mall.lenovo.com.cn/">门店</a>
            </li>
            <li class="lis">
                <a href="https://brand.lenovo.com.cn/">品牌</a>
            </li>
            <img class="phone" src="./images/注册页图片/phone.png" alt="">
        </ul>
    </header>
    <div class="registerbox">
        <h2>注册联想会员</h2>
        <form>
            <p>
                <input type="text" name="name" value="" placeholder="输入用户名" class="infbox">
            </p>
            <p>
                <input type="text" name="pwd" value="" placeholder="输入密码" class="infbox">
            </p>
            <p>
                <div class="infbox">
                    <div class="sex">
                        性别 <input name="sex" checked type="radio" value="男">男
                        <input name="sex" type="radio" value="女">女
                    </div>
            </p>
    </div>
    <p>
        <input name="tel" placeholder="输入手机号" class="infbox">
    </p>
    <p>
        <input name="email" placeholder="输入邮箱" class="infbox">
    </p>
    <p>
        <button>注册</button>
    </p>
    <br><span class="agreementInfo">注册账号即表示您同意并愿意遵守联想 <a
            href="https://shop.lenovo.com.cn/investor/html/legal.html">使用条款</a> 和 <a
            href="https://www.lenovo.com.cn/statement/privacy.html" target="_blank">隐私权政策</a></span>
    <div class="line"></div>
    <span class="go_login">已有账号 <a href="./sign.html" class="go-login">点此登录&gt;</a></span>
    </form>
    </div>

    <script>
        $(function () {
            $("form").on("submit", function () {

                var data = $("form").serialize();

                $.ajax({
                    url: "/reg",
                    type: "post",
                    data: data
                }).then(function (res) {
                    console.log(res);
                    let {
                        code,
                        msg,
                        data
                    } = res;
                    if (code == 200) {

                        //是否跳转到主页
                        layer.confirm("注册成功!是否立即登录", {
                            btn: ["确定", "取消"]
                        }, (index) => {

                            layer.close(index);
                            location.href = "./index.html";
                        }, () => {

                        })


                    } else {
                        layer.msg(msg);
                    }


                })

                return false;
            })
        })
    </script>

</body>

</html>